<?
include '../include/config.php';
include '../include/common.php';
$table = null;
$field = null;
$where = null;
$order = null;
header('Content-type: text/xml; charset=utf-8');
if (!empty($_GET['table'])) {
	$table = get('table');
	if (!empty($_GET['field'])) {
		$field = get('field');
		$field = '`' . str_replace(',', '`,`', $field) . '`';
		$sql = "SELECT $field FROM `$table`";
		$result = mysql_query($sql);
		echo '<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
		echo '<xml>' . "\r\n";
		while ($row = mysql_fetch_row($result)) {
			echo '<table name="' . $table . '">' . "\r\n";
			foreach ($row as $value) {
				echo '  <field>' . $value . '</field>' . "\r\n";
			}
			echo '</table>' . "\r\n";
		}
		echo '</xml>' . "\r\n";
	}
}
?>